package org.javaopenaccess.dao;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.db4o.ObjectContainer;

public abstract class AbstractDb4oTransactionManager{
	
	protected Logger logger = LoggerFactory.getLogger(this.getClass().getName());
	
	public AbstractDb4oTransactionManager(){
	}
	
	public void stopTransaction(ObjectContainer container, boolean commit){
		if (commit){
			container.commit();
		}
		else{
			container.rollback();	
		}
		container.close();
		logger.debug("session closed");
	}
}
